how to find number of factors for given number in java